/*
  学习目标：切换路由模式
*/

import React from 'react';
// 👍  使用as语法将重命名为Router
import { BrowserRouter as Router, Route, Link } from 'react-router-dom';

export default class App extends React.Component {
  render() {
    return (
      <>
        <Router>
          <div>
            <h1>app组件</h1>
            <div className="test">
              <Route path="/home" component={Home}></Route>
            </div>

            <Route path="/my" component={MyMusic}></Route>
            <Route path="/friend" component={Friend}></Route>

            <Link to="/home">首页</Link>
            <Link to="/my">我的</Link>
            <Link to="/friend">朋友</Link>
          </div>
        </Router>
      </>
    );
  }
}

function Home() {
  return <h1>我是首页组件</h1>;
}

function MyMusic() {
  return <h1>我是我的音乐件</h1>;
}

function Friend() {
  return <h1>我是朋友组件</h1>;
}
